const HtmlWebpackPlugin = require('html-webpack-plugin')

const webpack = require('webpack')
const path = require('path')
const config = require('./webpack.common')
const { merge } = require('webpack-merge')

module.exports = (env, argv) => {
    return merge(config, {
        mode: 'development',
        entry: ['webpack-hot-middleware/client'],
        output: {
            publicPath: '/'
        },
        devtool: 'cheap-module-source-map',
        watch: true,
        plugins: [
            new HtmlWebpackPlugin({
                title: 'producted by heaven',
                template: './public/index.html'
            }),
            new webpack.DefinePlugin({
                BASE_URL: '""'
            }),
            new webpack.HotModuleReplacementPlugin()
        ]
    })
}
